<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{:L("_PLUGIN_LIST_")}</h2>
    </div>
    <div class="with-padding">
    <div class="clearfix">
        <ul class="nav nav-primary pull-left">
            <li id="type_all"><a href="{:U('index',array('type'=>'all'))}">{:L("_ALL_")}</a></li>
            <li id="type_yes"><a href="{:U('index',array('type'=>'yes'))}">{:L("_NOT_INSTALLED_")}</a></li>
            <li id="type_no"><a href="{:U('index',array('type'=>'no'))}">{:L("_INSTALLED_")}</a></li>
            <script>
                $('#type_{$type}').addClass('active');
            </script>
        </ul>
        <div class="btn-group pull-right">
            <a class="btn btn-danger" href="{:U('hooks')}">{:L("_HOOK_MANAGEMENT_")}</a>

            <a class="btn btn-primary" href="{:U('create')}">{:L("_QUICK_CREATE_PLUGIN_")}</a>
        </div>
        </div>
        <div class="module-list cards">
            <notempty name="_list">
                <volist name="_list" id="vo">
                <div class="col-lg-3 col-md-4">
                    <div class="module-list-box">
                        <div class="card">
                            <div class="media-wrapper">
                                <a href="{:U('config',array('id'=>$vo['id']))}">
                                    <empty name="vo.icon_photo">
                                        <div class="cover-icon">
                                            <img src="__IMG__/plugin.png" alt=""> 
                                        </div>
                                    <else/>
                                        <div class="cover-icon">
                                            <img src="{$vo.icon_photo}" alt=""> 
                                        </div>
                                    </empty>
                                    
                                </a>
                            </div>

                            <!--<span class="caption">{$vo.description}</span>-->

                            <div class="content-wrapper">
                                <div class="card-heading title">
                                    <h3>{$vo.title} <span class="text-muted">{$vo.name}</span></h3>
                                </div>

                                <div class="card-content">
                                    <p class="text-muted text-ellipsis">{$vo.description}</p>
                                    <p class="text-muted text-ellipsis">{$vo.author}</p>
                                </div>
                                <div class="card-actions">
                                    <div class="btn-group">
                                        <empty name="vo.uninstall">
                                            <?php
                								$class	= get_addon_class($vo['name']);
                								if(!class_exists($class)){
                									$has_config = 0;
                								}else{
                									$addon = new $class();
                									$has_config = count($addon->getConfig());
                                                }
                                            ?>
                                            <?php if ($has_config): ?>
                                            <a class="btn btn-primary" href="{:U('config',array('id'=>$vo['id']))}">{:L("_SET_UP_")}</a>
                                            <?php endif ?>
                                            <?php if ($vo['status'] >=0): ?>
                                            <eq name="vo.status" value="0">
                                                <a class="btn btn-primary ajax-get"
                                                   href="{:U('enable',array('id'=>$vo['id']))}">{:L("_ENABLE_")}</a>
                                                <else/>
                                                <a class="btn btn-info ajax-get"
                                                   href="{:U('disable',array('id'=>$vo['id']))}">{:L("_DISABLE_")}</a>
                                            </eq>
                                            <?php endif ?>
                                            {//
                                            <eq name="vo.author" value="thinkphp">}
                                                <a class="btn btn-danger ajax-get"
                                                   href="{:U('uninstall?id='.$vo['id'])}">{:L("_UNINSTALL_")}</a>
                                                {//
                                            </eq>
                                            }
                                            <else/>
                                            <a class="btn btn-success ajax-get"
                                               href="{:U('install?addon_name='.$vo['name'])}">{:L("_INSTALL_")}</a>
                                        </empty>
                                    </div>
                                    <span class="pull-right">
                                        <span class="label label-success">{$vo.version}</span>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                    </div>
                </volist>
                <else/>
                <div class="text-center"> aOh!{:L("_THERE_IS_NO_CONTENT_")}</div>
            </notempty>

        </div>
    </div>


    <!-- 数据列表 -->
    <!-- 分页 -->
    <div class="with-padding">
        {$_page}
    </div>
</block>
